<%-- 
    Document   : journal
    Created on : 04.08.2009, 13:05:27
    Author     : Mario
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../STYLES/serverStyles.css" />
        <title>FBIS - ADMIN / KASSENBUCH</title>
        <SCRIPT language="JavaScript">
            function sub() {
                document.acc.submit();
            }
            function repl() {
                var tmp = document.book.val.value;
                tmp = tmp.replace((/,/g),".");
                document.book.val.value = tmp;
                for (i = 0; i < document.book.val.value.length; ++i)
                    if (document.book.val.value.charAt(i) < "0" ||
                        document.book.val.value.charAt(i) > "9")
                        if(document.book.val.value.charAt(i)!=".")
                {
                    chkZ = -1;
                } else {
                    chkZ = 0;
                }

                if (chkZ == -1) {
                    document.book.val.style.backgroundColor = "#ff0000";
                    document.book.val.focus();
                } else {
                    document.book.val.style.backgroundColor = "#ffffff";
                }
            }
        </SCRIPT>
    </head>
    <body>
        <jsp:useBean id="journal" scope="application" class="de.stalinski.db.JournalConnector" />
        <jsp:useBean id="accounts" scope="application" class="de.stalinski.db.AccountsConnector" />
        <div id="container">
            <div id="header">
                <jsp:include page="../HTML/header.html"/>
            </div>
            <div id="leftBar">

                <div class="leftMenu">
                    <table>
                        <tbody>

                            <tr>
                                <td>Konto:&nbsp;</td>
                                <!-- hier automatik einfügen -->
                                <td><%= accounts.getAccountsNameDropDown(true)%></td><td>anzeigen</td>
                            </tr>
                            <tr>

                                <td colspan="3"><a class="button" href="../menu.jsp"><span>Zurück</span></a></td>
                            </tr>
                        </tbody>
                    </table>
                </div>

            </div>
            <div id="content"><div class="scroll">
                    <table class="Prices" cellspacing="0"><tbody>
                            <tr>

                                <td>
                                    <%
        if (request.getParameterMap().isEmpty()) {
            out.print(journal.showTotalJournal(-1));
        } else {
            if (!request.getParameter("account").equals("Alle")) {
                String account = request.getParameter("account");
                int accountID = accounts.getAccountID(account);
                out.print(journal.showTotalJournal(accountID));
            } else {
                out.print(journal.showTotalJournal(-1));
            }
        }
                                    %>
                                </td>
                                <td>
                                    <form name="book" method="GET" action="newBooking.jsp">
                                        <table class="Prices" cellspacing="0">
                                            <tbody>
                                                <thead>
                                                    <th colspan="2">Neue Buchung</th>
                                                </thead>
                                                <tr>
                                                    <td>Datum:</td>
                                                    <td><input type="text" name="date" readonly value="<%= accounts.getDate()%>" /></td>
                                                </tr>
                                                <tr>
                                                    <td>Buchungsnummer:</td>
                                                    <td><input type="text" name="book_id" readonly value="<%= accounts.buildBookNumber()%>"/></td>
                                                </tr>
                                                <tr>
                                                    <td>Betreff:</td>
                                                    <td><textarea name="subject"></textarea></td>
                                                </tr>
                                                <tr>
                                                    <td>Kategorie:</td>
                                                    <td><select name="category">
                                                            <option>Ohne</option>
                                                        </select>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>Konto:</td>
                                                    <td><%= accounts.getAccountsNameDropDown(false)%></td>
                                                </tr>
                                                <tr>
                                                    <td>Betrag:</td>
                                                    <td><input type="text" name="val" onblur="repl()" onkeyup="repl()"/></td>
                                                </tr>
                                                <tr>
                                                    <td><input type="submit" value="Buchen"/></td>
                                                    <td><input type="reset" value="Abbrechen"/></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </form>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="footer" >
                <jsp:include page="../HTML/footer.html"/>
            </div>
        </div>
    </body>
</html>
